/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 30318
 * Date: 2023-12-12
 * Time: 19:06
 */
public class Deck {
    Card [] cards;// 用于储存52张牌
    char[] suit = { '黑', '红', '梅', '方' };
    String[] rank = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" };
    public  Deck() {
        cards = new Card[52];
        for (int i = 0; i < suit.length; i++) {
            for (int j = 0; j < rank.length; j++) {
                cards[i*13+j]= new Card(suit[i], rank[j]);
            }
        }
        System.out.println("一共有:" + cards.length + "张牌");
    }

    public void show() {
        for (int i = 0; i < cards.length; i++) {
            Card temp = cards[i];
            System.out.print(temp.suit + temp.rank);
            if ((i + 1) % 13 == 0)
                System.out.println();
        }
    }

    public Card show(int idx) {
        return cards[idx - 1];
    }
}